
// Open MoneySpinner Suite v1
// An open source business management software system written in Java and MySQL
// Recommended IDE is NetBeans IDE 7.0.1
// Support Web Site: http://www.milliscript.com
//
// Copyright (C) 2014, Abiodun Aremu, Ibadan/NIGERIA.
// Open MoneySpinner Suite is distributed under the terms of the Apache License version 2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*
 * ConsentCreditOrder.java
 *
 * Created on Jan 25, 2011, 3:48:53 PM
 */

package openmoneyspinnersuite;

/**
 *
 * @author Abiodun Aremu
 */
import javax.swing.*;
import java.text.*;
import java.sql.*;

final class ConsentCreditOrder extends javax.swing.JInternalFrame {

    Object[][] tableObject=new Object[][]{};
    Systems systems=new Systems();
    Thread consentCreditOrderThread=new Thread();
    Thread consentCreditOrderTitleThread=new Thread();
        String creditBy;
        PreparedStatement statement;
        String creditByID;
        String orderBy;
        String orderByID;
        String consentBy;
        String consentByID;
        String accountCode;
        String accountUnit;
        String accountName;
        String creditCode;
        String refDepartmentCode;
        String postDate;
        String orderDate;
        String totalAmount;
        String[] dbSerial;
        String[] dbItem;
        String[] dbDescription;
        String[] dbAmount;
        String transactionType;
        String transactionTypeCode;
        String transactionNumber;
        String transactionDate;
        String[] dbCreditCode;
        String[] dbCreditDate;
        DateFormat dateFormat=DateFormat.getDateInstance(DateFormat.LONG);

    /** Creates new form ViewPendingCreditOrder */
     ConsentCreditOrder() {
        initComponents();
        setTitle("::. Credit Consent By User ("+OpenMSApp.EmployeeName+")");
        reset();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jNameTextField = new javax.swing.JTextField();
        jComboBox1 = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jTotAmountTextField = new javax.swing.JTextField();
        jOrderDateTextField = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jConsentButton = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jRefDepartmentTextField = new javax.swing.JTextField();
        jTransactionTypeTextField = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jTransactionNumberTextField = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jTransactionDateTextField = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jCostOrderCodeTextField = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jAccountNameTextField = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jTransactionUnitTextField = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jOrderByTextField = new javax.swing.JTextField();
        jDeleteButton = new javax.swing.JButton();
        jDateTextField = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jActivityTextField = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();

        setClosable(true);
        setIconifiable(true);
        setMaximizable(true);
        setResizable(true);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(openmoneyspinnersuite.OpenMS_Finance_App.class).getContext().getResourceMap(ConsentCreditOrder.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setFrameIcon(resourceMap.getIcon("Form.frameIcon")); // NOI18N
        setName("Form"); // NOI18N
        setVisible(true);

        jPanel1.setName("jPanel1"); // NOI18N

        jLabel1.setFont(resourceMap.getFont("jLabel6.font")); // NOI18N
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jNameTextField.setEditable(false);
        jNameTextField.setName("jNameTextField"); // NOI18N
        jNameTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jNameTextFieldActionPerformed(evt);
            }
        });

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "-- Select --", "Item 2", "Item 3", "Item 4" }));
        jComboBox1.setName("jComboBox1"); // NOI18N
        jComboBox1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox1ActionPerformed(evt);
            }
        });

        jLabel2.setFont(resourceMap.getFont("jLabel6.font")); // NOI18N
        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel4.setFont(resourceMap.getFont("jLabel6.font")); // NOI18N
        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jTotAmountTextField.setEditable(false);
        jTotAmountTextField.setName("jTotAmountTextField"); // NOI18N
        jTotAmountTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTotAmountTextFieldActionPerformed(evt);
            }
        });

        jOrderDateTextField.setEditable(false);
        jOrderDateTextField.setName("jOrderDateTextField"); // NOI18N
        jOrderDateTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jOrderDateTextFieldActionPerformed(evt);
            }
        });

        jLabel5.setFont(resourceMap.getFont("jLabel6.font")); // NOI18N
        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jConsentButton.setText(resourceMap.getString("jConsentButton.text")); // NOI18N
        jConsentButton.setName("jConsentButton"); // NOI18N
        jConsentButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jConsentButtonActionPerformed(evt);
            }
        });

        jLabel3.setFont(resourceMap.getFont("jLabel6.font")); // NOI18N
        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jRefDepartmentTextField.setEditable(false);
        jRefDepartmentTextField.setName("jRefDepartmentTextField"); // NOI18N
        jRefDepartmentTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRefDepartmentTextFieldActionPerformed(evt);
            }
        });

        jTransactionTypeTextField.setEditable(false);
        jTransactionTypeTextField.setName("jTransactionTypeTextField"); // NOI18N
        jTransactionTypeTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTransactionTypeTextFieldActionPerformed(evt);
            }
        });

        jLabel6.setFont(resourceMap.getFont("jLabel6.font")); // NOI18N
        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        jTransactionNumberTextField.setEditable(false);
        jTransactionNumberTextField.setName("jTransactionNumberTextField"); // NOI18N
        jTransactionNumberTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTransactionNumberTextFieldActionPerformed(evt);
            }
        });

        jLabel7.setFont(resourceMap.getFont("jLabel6.font")); // NOI18N
        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        jTransactionDateTextField.setEditable(false);
        jTransactionDateTextField.setName("jTransactionDateTextField"); // NOI18N
        jTransactionDateTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTransactionDateTextFieldActionPerformed(evt);
            }
        });

        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        jCostOrderCodeTextField.setEditable(false);
        jCostOrderCodeTextField.setName("jCostOrderCodeTextField"); // NOI18N
        jCostOrderCodeTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCostOrderCodeTextFieldActionPerformed(evt);
            }
        });

        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N

        jAccountNameTextField.setEditable(false);
        jAccountNameTextField.setName("jAccountNameTextField"); // NOI18N
        jAccountNameTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jAccountNameTextFieldActionPerformed(evt);
            }
        });

        jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
        jLabel10.setName("jLabel10"); // NOI18N

        jTransactionUnitTextField.setEditable(false);
        jTransactionUnitTextField.setName("jTransactionUnitTextField"); // NOI18N
        jTransactionUnitTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTransactionUnitTextFieldActionPerformed(evt);
            }
        });

        jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
        jLabel11.setName("jLabel11"); // NOI18N

        jLabel12.setFont(resourceMap.getFont("jLabel12.font")); // NOI18N
        jLabel12.setText(resourceMap.getString("jLabel12.text")); // NOI18N
        jLabel12.setName("jLabel12"); // NOI18N

        jLabel13.setText(resourceMap.getString("jLabel13.text")); // NOI18N
        jLabel13.setName("jLabel13"); // NOI18N

        jOrderByTextField.setEditable(false);
        jOrderByTextField.setName("jOrderByTextField"); // NOI18N
        jOrderByTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jOrderByTextFieldActionPerformed(evt);
            }
        });

        jDeleteButton.setText(resourceMap.getString("jDeleteButton.text")); // NOI18N
        jDeleteButton.setName("jDeleteButton"); // NOI18N
        jDeleteButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jDeleteButtonActionPerformed(evt);
            }
        });

        jDateTextField.setEditable(false);
        jDateTextField.setName("jDateTextField"); // NOI18N
        jDateTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jDateTextFieldActionPerformed(evt);
            }
        });

        jLabel14.setText(resourceMap.getString("jLabel14.text")); // NOI18N
        jLabel14.setName("jLabel14"); // NOI18N

        jActivityTextField.setEditable(false);
        jActivityTextField.setName("jActivityTextField"); // NOI18N
        jActivityTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jActivityTextFieldActionPerformed(evt);
            }
        });

        jLabel15.setText(resourceMap.getString("jLabel15.text")); // NOI18N
        jLabel15.setName("jLabel15"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE)
                            .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE)
                            .addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE)
                            .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE)
                            .addComponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE)
                            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE)
                            .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jTotAmountTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jDateTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                            .addComponent(jTransactionTypeTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jNameTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jTransactionDateTextField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE)
                                    .addComponent(jTransactionNumberTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                            .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                .addComponent(jTransactionUnitTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(104, 104, 104)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel3)
                                    .addComponent(jLabel13)
                                    .addComponent(jLabel5)
                                    .addComponent(jLabel10)
                                    .addComponent(jLabel15))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jAccountNameTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 253, Short.MAX_VALUE)
                                    .addComponent(jRefDepartmentTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 253, Short.MAX_VALUE)
                                    .addComponent(jOrderDateTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 253, Short.MAX_VALUE)
                                    .addComponent(jOrderByTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 253, Short.MAX_VALUE)
                                    .addComponent(jActivityTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 253, Short.MAX_VALUE)
                                    .addComponent(jCostOrderCodeTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 253, Short.MAX_VALUE)))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jConsentButton)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jDeleteButton))))
                    .addComponent(jLabel12))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel1))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTransactionTypeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel6))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTransactionNumberTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel7))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTransactionDateTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTransactionUnitTextField)
                            .addComponent(jLabel11))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTotAmountTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jDateTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel14))
                        .addGap(8, 8, 8)
                        .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(11, 11, 11))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jCostOrderCodeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel9))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel10)
                            .addComponent(jAccountNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(jRefDepartmentTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(5, 5, 5)
                                .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jOrderDateTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jOrderByTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jActivityTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jDeleteButton, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jConsentButton, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap())
        );

        jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "S/N", "Item", "Description", "Amount"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTable1.setName("jTable1"); // NOI18N
        jScrollPane1.setViewportView(jTable1);
        jTable1.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("jTable1.columnModel.title0")); // NOI18N
        jTable1.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("jTable1.columnModel.title3")); // NOI18N
        jTable1.getColumnModel().getColumn(2).setHeaderValue(resourceMap.getString("jTable1.columnModel.title4")); // NOI18N
        jTable1.getColumnModel().getColumn(3).setHeaderValue(resourceMap.getString("jTable1.columnModel.title5")); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 984, Short.MAX_VALUE)
            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jNameTextFieldActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jNameTextFieldActionPerformed

    private void jTotAmountTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTotAmountTextFieldActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jTotAmountTextFieldActionPerformed

    private void jOrderDateTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jOrderDateTextFieldActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jOrderDateTextFieldActionPerformed

    private void jConsentButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jConsentButtonActionPerformed
        
            /* Execute submit thread */
            consentCreditOrderThread=new Thread(new Runnable() {
                public void run() {
                    disableControls();
                    consentCreditOrder();
                }
            });
            consentCreditOrderTitleThread=new Thread(new Runnable() {
                public void run() {
                    while(consentCreditOrderThread.isAlive())setProcessingTitle(consentCreditOrderTitleThread);
                    enableControls();
                    System.out.println("consentCreditOrderThread stopped runing.");
                }
            });
            consentCreditOrderThread.start();
            consentCreditOrderTitleThread.start();
    }//GEN-LAST:event_jConsentButtonActionPerformed
    private void consentCreditOrder()
    {
        if(jComboBox1.getSelectedItem().equals("-- Select --"))
        {
            JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),"PLEASE SELECT A ORDER CODE ","ERROR !",JOptionPane.ERROR_MESSAGE);
            return;
        }
        String accountName=jAccountNameTextField.getText().trim();
        String accountStatus=systems.getValue(OpenMSApp.Database_A, "Select * from Account where vAccountName='"+accountName+"'", "cStatus");
        if(accountStatus.equalsIgnoreCase("Frozen"))
        {
            JOptionPane.showMessageDialog(JOptionPane.getRootFrame()," SELECTED ACCOUNT IS FROZEN ! SEE YOU ACCOUNT ADMINISTRATOR FOR DETAILS.","ERROR !",JOptionPane.ERROR_MESSAGE);
            return;
        }
        else
        {
                    consentCurrentOrderCode();
                    reset();
        }    
    }
    private void setProcessingTitle(Thread thread)
    {
        try{
            this.setTitle("::. Credit Consent By User ("+OpenMSApp.EmployeeName+") - Processing Request");
            thread.sleep(500);
            this.setTitle("::. Credit Consent By User ("+OpenMSApp.EmployeeName+") - Processing Request.");
            thread.sleep(500);
            this.setTitle("::. Credit Consent By User ("+OpenMSApp.EmployeeName+") - Processing Request..");
            thread.sleep(500);
            this.setTitle("::. Credit Consent By User ("+OpenMSApp.EmployeeName+") - Processing Request...");
            thread.sleep(500);
        }catch(Exception e){System.out.println("Title thread"+e);}
    }
    private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
        
            /* Execute submit thread */
            consentCreditOrderThread=new Thread(new Runnable() {
                public void run() {
                    disableControls();
                    orderIDSelected();
                }
            });
            consentCreditOrderTitleThread=new Thread(new Runnable() {
                public void run() {
                    while(consentCreditOrderThread.isAlive())setProcessingTitle(consentCreditOrderTitleThread);
                    enableControls();
                    System.out.println("consentCreditOrderThread stopped runing.");
                }
            });
            consentCreditOrderThread.start();
            consentCreditOrderTitleThread.start();
    }//GEN-LAST:event_jComboBox1ActionPerformed
    private void orderIDSelected()
    {
            String orderCode=jComboBox1.getSelectedItem().toString();
            resetField();

        if(orderCode.equals("-- Select --"))
        {
            resetOrderCode();
            resetTable();
        }
        String status=systems.getValue(OpenMSApp.Database_A, "Select * from creditOrder where cCreditOrderCode='"+orderCode+"'", "cStatus");
        if(status.equalsIgnoreCase("approved")||status.equalsIgnoreCase("deleted")){
        reset();
        return;
        }
       else
       {
           setFields(orderCode);
        }
    }
    private void setFields(String orderCode)
    {
            creditByID=systems.getValue(OpenMSApp.Database_A, "Select * from creditOrder where cCreditOrderCode='"+orderCode+"'", "cMerchantID");
            orderByID=systems.getValue(OpenMSApp.Database_A, "Select * from creditOrder where cCreditOrderCode='"+orderCode+"'", "cOrderByID");
            orderDate=systems.getValue(OpenMSApp.Database_A, "Select * from creditOrder where cCreditOrderCode='"+orderCode+"'", "dOrderDate");
            totalAmount=systems.getValue(OpenMSApp.Database_A, "Select * from creditOrder where cCreditOrderCode='"+orderCode+"'", "mTotalAmount");
            accountCode=systems.getValue(OpenMSApp.Database_A, "Select * from creditOrder where cCreditOrderCode='"+orderCode+"'", "cAccountCode");
            transactionDate=systems.extractSQLDate(systems.getDateValue(OpenMSApp.Database_A, "Select * from creditOrder where cCreditOrderCode='"+orderCode+"'", "dCreditDate"));
            transactionNumber=systems.getValue(OpenMSApp.Database_A, "Select * from creditOrder where cCreditOrderCode='"+orderCode+"'", "vCreditingNumber");
            transactionTypeCode=systems.getValue(OpenMSApp.Database_A, "Select * from creditOrder where cCreditOrderCode='"+orderCode+"'", "cTransactionTypeCode");
            refDepartmentCode=systems.getValue(OpenMSApp.Database_A, "Select * from creditOrder where cCreditOrderCode='"+orderCode+"'", "cReferalDepartmentCode");

            dbDescription=systems.getColumn(OpenMSApp.Database_A,"Select * from creditordersummary where cCreditOrderCode= '"+orderCode+"'",3);
            dbAmount=systems.getColumn(OpenMSApp.Database_A,"Select * from creditordersummary where cCreditOrderCode='"+orderCode+"'",4);
            dbSerial=systems.getColumn(OpenMSApp.Database_A,"Select * from creditordersummary where cCreditOrderCode='"+orderCode+"'",5);
            dbItem=systems.getColumn(OpenMSApp.Database_A,"Select * from creditordersummary where cCreditOrderCode='"+orderCode+"'",2);


            creditBy=systems.getValue(OpenMSApp.Database_A,"Select * from vwMerchant where cMerchantID='"+creditByID+"'","vName");
            accountName=systems.getValue(OpenMSApp.Database_A,"Select * from Account where cAccountCode='"+accountCode+"'","vAccountName");
            accountUnit=systems.getValue(OpenMSApp.Database_A,"Select * from Account where cAccountCode='"+accountCode+"'","vAccountUnit");
            transactionType=systems.getValue(OpenMSApp.Database_A,"Select * from TransactionType where cTransactionTypeCode='"+transactionTypeCode+"'","vTransactionType");
            String OrderEmployeeID=systems.getValue(OpenMSApp.Database_A,"Select * from login where cLoginCode= '"+orderByID+"'","cEmployeeID");

            orderBy=systems.getValue(OpenMSApp.Database_A,"Select * from Employee where cEmployeeID='"+OrderEmployeeID+"'","vFirstName").trim()+" "+
                    systems.getValue(OpenMSApp.Database_A,"Select * from Employee where cEmployeeID='"+OrderEmployeeID+"'","vMiddleName").trim()+" "+
                    systems.getValue(OpenMSApp.Database_A,"Select * from Employee where cEmployeeID='"+OrderEmployeeID+"'","vlastName").trim();

            orderDate=systems.getValue(OpenMSApp.Database_A,"Select * from creditOrder where cCreditOrderCode='"+orderCode+"'","dOrderDate");
            String refDepartment=systems.getValue(OpenMSApp.Database_A,"Select * from department where cDepartmentCode='"+refDepartmentCode+"'","vDepartmentName");

            jNameTextField.setText(creditBy.trim());
            jTransactionTypeTextField.setText(transactionType.trim());
            jTransactionNumberTextField.setText(transactionNumber.trim());
            jTransactionUnitTextField.setText(accountUnit.trim());
            jTransactionDateTextField.setText(transactionDate.trim());
            try
            {
                jTotAmountTextField.setText(systems.converToRealMoneyFormat(totalAmount.trim()));
            }
            catch(Exception e)
            {
                jTotAmountTextField.setText("Er!M1C01K0");
            }
            jAccountNameTextField.setText(accountName.trim());
            jOrderDateTextField.setText(orderDate.trim());
            jRefDepartmentTextField.setText(refDepartment.trim());
            jOrderByTextField.setText(orderBy);
            jActivityTextField.setText(systems.getValue(OpenMSApp.Database_A, "Select * from CreditOrder where cCreditOrderCode='"+orderCode+"'", "cActivity"));
            refreshTable();
    }
    private void jRefDepartmentTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRefDepartmentTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jRefDepartmentTextFieldActionPerformed

    private void jTransactionTypeTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTransactionTypeTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTransactionTypeTextFieldActionPerformed

    private void jTransactionNumberTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTransactionNumberTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTransactionNumberTextFieldActionPerformed

    private void jTransactionDateTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTransactionDateTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTransactionDateTextFieldActionPerformed

    private void jCostOrderCodeTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCostOrderCodeTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jCostOrderCodeTextFieldActionPerformed

    private void jAccountNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jAccountNameTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jAccountNameTextFieldActionPerformed

    private void jTransactionUnitTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTransactionUnitTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTransactionUnitTextFieldActionPerformed

    private void jOrderByTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jOrderByTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jOrderByTextFieldActionPerformed

    private void jDeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jDeleteButtonActionPerformed
        
            /* Execute submit thread */
            consentCreditOrderThread=new Thread(new Runnable() {
                public void run() {
                    disableControls();
                    deleteButtonSelected();
                }
            });
            consentCreditOrderTitleThread=new Thread(new Runnable() {
                public void run() {
                    while(consentCreditOrderThread.isAlive())setProcessingTitle(consentCreditOrderTitleThread);
                    enableControls();
                    System.out.println("deleteCreditOrderThread stopped runing.");
                }
            });
            consentCreditOrderThread.start();
            consentCreditOrderTitleThread.start();

    }//GEN-LAST:event_jDeleteButtonActionPerformed
    private void deleteButtonSelected()
    {
        if(jComboBox1.getSelectedItem().equals("-- Select --"))
        {
            JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),"Please Select A Order Code ","ERROR !",JOptionPane.ERROR_MESSAGE);
            return;
        }
        else
        {
                    deleteCurrentOrderCode();
                    reset();
        }
    }
    private void jDateTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jDateTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jDateTextFieldActionPerformed

    private void jActivityTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jActivityTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jActivityTextFieldActionPerformed

     void resetOrderCode()
    {
        String[] orderCode=systems.getTableDataArray(OpenMSApp.Database_A,"vwPendingCreditOrder",1);
        orderCode[0]="-- Select --";
        jComboBox1.setModel(new DefaultComboBoxModel(orderCode));
    }
     void resetTable()
    {
        tableObject=new Object[][]{};
        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            tableObject,
            new String [] {
                "S/N", "Item","Description", "Amount"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false,false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTable1.getColumnModel().getColumn(0).setMinWidth(40);
        jTable1.getColumnModel().getColumn(0).setPreferredWidth(40);
        jTable1.getColumnModel().getColumn(0).setMaxWidth(40);
        jTable1.getColumnModel().getColumn(1).setPreferredWidth(10);
    }
     void resetField()
    {
            jNameTextField.setText("");
            jTotAmountTextField.setText("");
            jOrderDateTextField.setText("");
            jTransactionTypeTextField.setText("");
            jTransactionNumberTextField.setText("");
            jTransactionUnitTextField.setText("");
            jAccountNameTextField.setText("");
            jRefDepartmentTextField.setText("");
            jCostOrderCodeTextField.setText("");
            jTransactionDateTextField.setText("");
            jOrderByTextField.setText("");
            jActivityTextField.setText("");
    }
     void disableControls()
    {            
            jComboBox1.setEnabled(false);
            
            jConsentButton.setEnabled(false);
            jDeleteButton.setEnabled(false);
    }
     void enableControls()
    {
            jComboBox1.setEnabled(true);
            
            jConsentButton.setEnabled(true);
            jDeleteButton.setEnabled(true);
            
            setTitle("::. Credit Consent By User ("+OpenMSApp.EmployeeName+")");
    }
     void resetCombo()
    {
        resetOrderCode();
    }
     void reset()
    {
        resetField();
        resetTable();
        resetCombo();
        resetDate();
    }
     void refreshTable()
    {
        int x=0;
        int y=dbSerial.length;

        tableObject=new Object[y][4];

        while(x<y)
        {
            String itemName=systems.getValue(OpenMSApp.Database_A, "Select * from Item where cItemCode='"+dbItem[x].trim()+"'", "vName");
            
            tableObject[x][0]=dbSerial[x].trim();
            tableObject[x][1]=itemName.trim();
            tableObject[x][2]=dbDescription[x].trim();
            try
            {
                tableObject[x][3]=systems.converToRealMoneyFormat(dbAmount[x].trim());
            }
            catch(Exception e)
            {
                tableObject[x][3]="Er!M1C01K0";
            }
        x+=1;
        if(x==y){break;}
       }

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            tableObject,
            new String [] {
                "S/N","Item", "Description", "Amount"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false,false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
    }
     void resetDate()
    {
        java.util.Calendar calendar= java.util.Calendar.getInstance();
        jDateTextField.setText(String.valueOf(calendar.getTime()));
    }
     void consentCurrentOrderCode()
    {
        String orderCode=jComboBox1.getSelectedItem().toString();
        String refID=systems.getValue(OpenMSApp.Database_A, "Select * from creditorder where cCreditOrderCode='"+String.valueOf(jComboBox1.getSelectedItem()).trim()+"'", "cRefID");

        String status=systems.getValue(OpenMSApp.Database_A, "Select * from debitOrder where cDebitOrderCode='"+orderCode+"'", "cStatus");
        if(status.equalsIgnoreCase("approved")||status.equalsIgnoreCase("deleted")){
        reset();
        return;
        }
        
        //Connect.createMSSQLConnection();
        Connect.changeDB(OpenMSApp.Database_A);
        statement=Connect.createStatement(Connect.procInit+"  prnUpdCreditOrderOnConsent"+Connect.procInitStart+"?,?"+Connect.procInitEnd);
            try{
            statement.setString(1,refID);
            statement.setString(2,OpenMSApp.LoginCode);
            }
            catch(Exception e)
            {
            System.out.println("ConsentCreditOrder.consentCurrentOrderCode gave error! "+e);
            }
        Connect.executeUpdateStatement(statement);
        
        statement=Connect.createStatement(Connect.procInit+"  prnUpdDebitOrderOnConsent"+Connect.procInitStart+"?,?"+Connect.procInitEnd);
            try{
            statement.setString(1,refID);
            statement.setString(2,OpenMSApp.LoginCode);
            }
            catch(Exception e)
            {
            System.out.println("ConsentDebitOrder.consentCurrentOrderCode gave error! "+e);
            }
        Connect.executeUpdateStatement(statement);
        
        Connect.alert="Y";
        Connect.closeConnection();
    }

     void deleteCurrentOrderCode()
    {
        String refID=systems.getValue(OpenMSApp.Database_A, "Select * from creditorder where cCreditOrderCode='"+String.valueOf(jComboBox1.getSelectedItem()).trim()+"'", "cRefID");

        String orderCode=jComboBox1.getSelectedItem().toString();
        String status=systems.getValue(OpenMSApp.Database_A, "Select * from debitOrder where cDebitOrderCode='"+orderCode+"'", "cStatus");
        if(status.equalsIgnoreCase("approved")||status.equalsIgnoreCase("deleted")){
        reset();
        return;
        }
        //Connect.createMSSQLConnection();
        Connect.changeDB(OpenMSApp.Database_A);
        statement=Connect.createStatement(Connect.procInit+"  prnDeleteCreditOrder"+Connect.procInitStart+"?,?"+Connect.procInitEnd);
            try{
            statement.setString(1,refID);
            statement.setString(2,OpenMSApp.LoginCode);
            }
            catch(Exception e)
            {
            System.out.println("ConsentCreditOrder.deleteCurrentOrderCode gave error! "+e);
            }
        Connect.executeUpdateStatement(statement);
        statement=Connect.createStatement(Connect.procInit+"  prnDeleteDebitOrder"+Connect.procInitStart+"?,?"+Connect.procInitEnd);
            try{
            statement.setString(1,refID);
            statement.setString(2,OpenMSApp.LoginCode);
            }
            catch(Exception e)
            {
            System.out.println("ConsentCreditOrder.deleteCurrentOrderCode gave error! "+e);
            }
        Connect.executeUpdateStatement(statement);
        Connect.alert="Y";
        Connect.closeConnection();
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField jAccountNameTextField;
    private javax.swing.JTextField jActivityTextField;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JButton jConsentButton;
    private javax.swing.JTextField jCostOrderCodeTextField;
    private javax.swing.JTextField jDateTextField;
    private javax.swing.JButton jDeleteButton;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JTextField jNameTextField;
    private javax.swing.JTextField jOrderByTextField;
    private javax.swing.JTextField jOrderDateTextField;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JTextField jRefDepartmentTextField;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JTextField jTotAmountTextField;
    private javax.swing.JTextField jTransactionDateTextField;
    private javax.swing.JTextField jTransactionNumberTextField;
    private javax.swing.JTextField jTransactionTypeTextField;
    private javax.swing.JTextField jTransactionUnitTextField;
    // End of variables declaration//GEN-END:variables

}
